package com.timo.rabbitmq.controller;


import com.timo.constant.RabbitMqConstant.*;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description: 类用途：
 * @Author: Timo
 * @Date: 2019/7/24 09:54
 */
@RestController
@RequestMapping("/fanout")
public class FanoutController {

    @Resource
    private RabbitTemplate rabbitTemplate;

    @GetMapping("/hello")
    public void hello() {

        rabbitTemplate.convertAndSend(FanoutExchangeEnum.HELLO_FANOUT_EXCHANGE.name,"","hello");
    }

    @GetMapping("/timo")
    public void timo(String msg) {

        rabbitTemplate.convertAndSend(FanoutExchangeEnum.TIMO_PUB_SUB_FANOUT_EXCHANGE.name,"",msg);
    }

    @GetMapping("/timo_two")
    public void timoTwo(String msg) {

        rabbitTemplate.convertAndSend(FanoutExchangeEnum.TIMO_TWO_PUB_SUB_FANOUT_EXCHANGE.name,"",msg);
    }

}
